package com.endava.spring.dao_impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.endava.spring.beans.Person;

/**
 * Maps the values of persons from Data Base. Implements interface
 * <code>RowMapper</code>.
 * 
 * @author acojocar
 * @since 30.07.2013
 * @version 1.0
 * 
 */
public class PersonMapper implements RowMapper {

	public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
		Person person = new Person();
		person.setPersonID(rs.getInt("person_id"));
		person.setFirstName(rs.getString("first_name"));
		person.setSurname(rs.getString("last_name"));
		person.setAddress(rs.getString("address"));
		return person;
	}

}
